package com.sxbang.friday.base.result;

import lombok.Data;

import java.io.Serializable;

/**
 * @author :ali
 * @date :2020/1/27 16:53
 * @description：dto 接收前端分页传递过来的limit和page
 * @modified By:
 * @version: 1.0.0
 */
@Data
public class PageTableRequest implements Serializable {
    private Integer page;
    private Integer limit;
    private Integer offset;

    /**
     * 通过page和limit计算offset
     * offset是数据库表的数据第几条
     */
    public void countOffset(){
        if (null == this.page || null == this.limit){
            this.offset =0;
        }
        this.offset = (this.page-1) * limit;
    }
}
